<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
    Document   : details.xhtml
    Created on : Feb 8 2014
    Author     : Ihab Ali
-->



<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">
    <body>
        <ui:composition template="../WEB-INF/templates/template.xhtml">
            <ui:define name="content">
                <h:form id="spaceForIP">
                    <h:panelGrid columns="2" border="2">
                        <h:column id="colOne">

                            <b>
                                <center>
                                    <h:outputText
                                        id="IPAddress" 
                                        value="#{msgResources.ipLabel}">
                                    </h:outputText>
                                </center>
                            </b>

                            <h:inputText id="octet1"
                                         label="octet1"
                                         required="true"
                                         size="7"
                                         maxlength="3"
                                         title="${msgResources.octet1}"
                                         requiredMessage="${msgResources.requiredOMessage}"
                                         value="#{controller.detail_model.octet1}">
                                         <f:validateLongRange
                                                minimum="0"
                                                maximum="223"/>
                            </h:inputText>
                            
                            <nbsp/>
                            <h:inputText id="octet2"
                                         label="octet2"
                                         required="true"
                                         requiredMessage="${msgResources.requiredOMessage}"
                                         size="8"
                                         maxlength="3"
                                         title="${msgResources.octet2}"
                                         value="#{controller.detail_model.octet2}">
                                         <f:validateLongRange
                                                minimum="0"
                                                maximum="255"/>
                            </h:inputText>
                            <nbsp/>
                            <h:inputText id="octet3"
                                         label="octet3"
                                         required="true"
                                         requiredMessage="${msgResources.requiredOMessage}"
                                         size="8"
                                         maxlength="3"
                                         title="${msgResources.octet3}"
                                         value="#{controller.detail_model.octet3}">
                                         <f:validateLongRange
                                                minimum="0"
                                                maximum="255"/>
                            </h:inputText>
                            <nbsp/>
                            <h:inputText id="octet4"
                                         label="octet4"
                                         required="true"
                                         requiredMessage="${msgResources.requiredOMessage}"
                                         size="8"
                                         maxlength="3"
                                         title="${msgResources.octet4}"
                                         value="#{controller.detail_model.octet4}">
                                         <f:validateLongRange
                                                minimum="0"
                                                maximum="255"/>
                                <nbsp/>
                            </h:inputText>
                        </h:column>
                        <h:column id="prefixCol">
                            <b>
                                <center>
                                    <h:outputText
                                        id="prefixLength" 
                                        value="#{msgResources.prefixLabel}">
                                    </h:outputText>
                                </center>
                            </b>
                            <h:selectOneMenu id="prefix"
                                             value="#{controller.detail_model.prefix}">

                                <f:selectItem id="item0"  itemValue="0" />
                                <f:selectItem id="item1"  itemValue="1" />
                                <f:selectItem id="item2"  itemValue="2" />
                                <f:selectItem id="item3"  itemValue="3" />
                                <f:selectItem id="item4"  itemValue="4" />
                                <f:selectItem id="item5"  itemValue="5" />
                                <f:selectItem id="item6"  itemValue="6" />
                                <f:selectItem id="item7"  itemValue="7" />
                                <f:selectItem id="item8"  itemValue="8" />
                                <f:selectItem id="item9"  itemValue="9" />
                                <f:selectItem id="item10"  itemValue="10" />
                                <f:selectItem id="item11"  itemValue="11" />
                                <f:selectItem id="item12"  itemValue="12" />
                                <f:selectItem id="item13"  itemValue="13" />
                                <f:selectItem id="item14"  itemValue="14" />
                                <f:selectItem id="item15"  itemValue="15" />
                                <f:selectItem id="item16"  itemValue="16" />
                                <f:selectItem id="item17"  itemValue="17" />
                                <f:selectItem id="item18"  itemValue="18" />
                                <f:selectItem id="item19"  itemValue="19" />
                                <f:selectItem id="item20"  itemValue="20" />
                                <f:selectItem id="item21"  itemValue="21" />
                                <f:selectItem id="item22"  itemValue="22" />
                                <f:selectItem id="item23"  itemValue="23" />
                                <f:selectItem id="item24"  itemValue="24" />
                                <f:selectItem id="item25"  itemValue="25" />
                                <f:selectItem id="item26"  itemValue="26" />
                                <f:selectItem id="item27"  itemValue="27" />
                                <f:selectItem id="item28"  itemValue="28" />
                                <f:selectItem id="item29"  itemValue="29" />
                                <f:selectItem id="item30"  itemValue="30" />
                                <f:selectItem id="item31"  itemValue="31" />

                            </h:selectOneMenu>
                        </h:column>
                    </h:panelGrid>
                    <p>
                        <h:commandButton id="detailsButton"
                                         action="#{controller.doCalculateDetailedInfo()}"
                                         title="${msgResources.ipCalculate}"
                                         value="${msgResources.ipCalculate}" />
                        <h:messages globalOnly="false"/>
                    </p>
                <hr></hr>
                <h:panelGrid columns="2">

                    <h:panelGrid columns="3" border="3">
                        <h:outputText value="Major (base) network address"/>
                        <h:outputText value="#{controller.detail_model.majorBaseNetAddress}" />
                        <h:outputText value="#{controller.detail_model.binaryMajorNetworkAddress}" />
                        
                        <h:outputText value="Major network mask"/>
                        <h:outputText value="#{controller.detail_model.majorNetworkMask}"/>
                        <h:outputText value="#{controller.detail_model.majorNetworkMaskInBinary}"/>
                        
                        <h:outputText value="Major network broadcast address"/>
                        <h:outputText value="#{controller.detail_model.baseNetBCast}"/>
                        <h:outputText value="#{controller.detail_model.majorNetworkBroadcastAddressInBinary}"/>
                            
                       

                    </h:panelGrid> 
                    <h:panelGrid columns="2" border="3">
                        <h:outputText value="Class"/>
                        <h:outputText value="#{controller.detail_model.networkClass}"/>
                        
                        <h:outputText value="Default number of host bits"/>
                        <h:outputText value="#{controller.detail_model.hostBits}"/>
                        
                        <h:outputText value="Default number of usable bits"/>
                        <h:outputText value="#{controller.detail_model.usableHosts}">
                        </h:outputText> 
                    </h:panelGrid>
                </h:panelGrid> 

                <h:panelGrid columns="5" border="3">
                    <h:column>
                        <h:outputText value="#{msgResources.privateAddressLabel}" />
                        <h:selectBooleanCheckbox value="#{controller.detail_model.privateAddress}" disabled ="true"/>
                    </h:column>

                    <h:column>
                        <h:outputText value="#{msgResources.defaultRouteLabel}"/>
                        <h:selectBooleanCheckbox value="#{controller.detail_model.defaultRoute}" disabled ="true" />
                    </h:column>

                    <h:column>
                        <h:outputText value="#{msgResources.loopBackLable}"/>
                        <h:selectBooleanCheckbox value="#{controller.detail_model.loopBack}" disabled ="true" />
                    </h:column>

                    <h:column>
                        <h:outputText value="#{msgResources.linkLocalLabel}"/>
                        <h:selectBooleanCheckbox value="#{controller.detail_model.linkLocal}" disabled ="true"/>
                    </h:column>

                    <h:column>
                        <h:outputText value="#{msgResources.TestNetLable}"/>
                        <h:selectBooleanCheckbox value="#{controller.detail_model.testNet}" disabled ="true"/>
                    </h:column>

                </h:panelGrid>

                <h:panelGrid columns="3">
                    <h:panelGrid columns="3" border="3">
                        <h:outputText value="#{msgResources.subnetMaskLabel}"/>
                        <h:outputText value="#{controller.detail_model.maskForSubnet}"/>
                        <h:outputText value="#{controller.detail_model.maskForSubnetInBinary}"/>
                        
                        <h:outputText value="#{msgResources.wildcardLable}"/>
                        <h:outputText value="#{controller.detail_model.wildcard}"/>
                        <h:outputText value="#{controller.detail_model.wildcardInBinary}"/>
                    </h:panelGrid>

                    <h:panelGrid columns="2" border="3">
                        <h:outputText value="#{msgResources.subnetBitsLable}"/>
                        <h:outputText value="#{controller.detail_model.subnetBits}"/>
                        <h:outputText value="#{msgResources.usableSubnetsLabel}"/>
                        <h:outputText value="#{controller.detail_model.usableSubnets}"/>
                    </h:panelGrid>

                    <h:panelGrid columns="2" border="3">
                        <h:outputText value="#{msgResources.hostBitsPerSubnetLabel}"/>
                        <h:outputText value="#{controller.detail_model.numberofHostsPerSubnet}"/>
                        <h:outputText value="#{msgResources.usableHostsperSubnetLabel}"/>
                        <h:outputText value="#{controller.detail_model.numberOfUsableHosts}"/>
                    </h:panelGrid>

                </h:panelGrid>

                <h:panelGrid id="briefAddressType" columns="5" border="2">
                    <h:column>
                        <h:outputText value="#{msgResources.networkAddressLabel}"/>
                        <h:selectBooleanCheckbox value="#{controller.detail_model.networkAddress}" 
                                                 disabled="true"/>
                    </h:column>
                    <h:column>
                        <h:outputText value="#{msgResources.hostLabel}"/>
                        <h:selectBooleanCheckbox value="#{controller.detail_model.host}" 
                                                 disabled="true"/>
                    </h:column>
                    <h:column>
                        <h:outputText value="#{msgResources.firstHostLabel}"/>
                        <h:selectBooleanCheckbox value="#{controller.detail_model.firstHost}" 
                                                 disabled="true"/>
                    </h:column>
                    <h:column>
                        <h:outputText value="#{msgResources.lastHostLabel}"/>
                        <h:selectBooleanCheckbox value="#{controller.detail_model.lastHost}" disabled="true"/>
                    </h:column>
                    <h:column>
                        <h:outputText value="#{msgResources.broadcastLabel}"/>
                        <h:selectBooleanCheckbox value="#{controller.detail_model.broadcast}" disabled="true"/>
                    </h:column>
                </h:panelGrid>

                <h:panelGrid id="briefInfo" columns="3" border="2">
                    <h:outputText value="#{msgResources.subnetAdressLabel}"/>
                    <h:outputText value="#{controller.detail_model.subNetworkAddress}"/>
                    <h:outputText value="#{controller.detail_model.subnetNetworkAddressInBinary}"/>

                    <h:outputText value="#{msgResources.firstHostAddressLabel}"/>
                    <h:outputText value="#{controller.detail_model.firstHostAddress}"/>
                    <h:outputText value="#{controller.detail_model.firstHostInBinary}"/>

                    <h:outputText value="#{msgResources.lastHostAddressLabel}"/>
                    <h:outputText value="#{controller.detail_model.subLastHost}"/>
                    <h:outputText value="#{controller.detail_model.lastHostAddressInBinary}"/>

                    <h:outputText value="#{msgResources.broadcastAddressLabel}"/>
                    <h:outputText value="#{controller.detail_model.broadcastAddress}"/>
                    <h:outputText value="#{controller.detail_model.broadcastAddressInBinary}"/>
                </h:panelGrid>
              </h:form>
            </ui:define>
        </ui:composition>

    </body>
</html>